package drds.server.sqlparser.sqlobject.statement.delete;

import drds.server.sqlparser.sqlobject.expression.Expression;
import drds.server.sqlparser.sqlobject.expression.name.IName;
import drds.server.sqlparser.sqlobject.statement.StatementImpl;
import drds.server.sqlparser.visitor.Visitor;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class DeleteStatement extends StatementImpl {

	protected IName tableName;
	protected Expression where;

	public DeleteStatement() {

	}

	public void setTableName(IName tableName) {
		this.tableName = tableName;
	}

	public IName getTableName() {
		return tableName;
	}

	public void setWhere(Expression where) {
		if (where != null) {
			where.setParent(this);
		}
		this.where = where;
	}

	public Expression getWhere() {
		return where;
	}

	@Override
	protected void accept0(Visitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, tableName);
			acceptChild(visitor, where);
		}
		visitor.endVisit(this);
	}

}
